//
//  MNDPlusRecordListCell.m
//  minidai
//
//  Created by Vitas on 2018/7/24.
//  Copyright © 2018年 迷你贷. All rights reserved.
//

#import "MNDPlusRecordListCell.h"

@interface MNDPlusRecordListCell()
/*! 标题 */
@property (weak, nonatomic) IBOutlet UILabel *investmentTitleLabel;
/*! 授权金额 */
@property (weak, nonatomic) IBOutlet UILabel *tenderMoneyLabel;
/*! 年化收益率 */
@property (weak, nonatomic) IBOutlet UILabel *yearAprLabel;
/*! 奖励收益率 */
@property (weak, nonatomic) IBOutlet UILabel *rewardAprLabel;
/*! 是否有奖励 */
@property (weak, nonatomic) IBOutlet UIImageView *isReward;
/*! 预期收益 */
@property (weak, nonatomic) IBOutlet UILabel *expectIncomeLabel;
/*! 投资时间 */
@property (weak, nonatomic) IBOutlet UILabel *tenderTimeLabel;
/*! 投资期限 */
@property (weak, nonatomic) IBOutlet UILabel *tenderDeadline;

@property (weak, nonatomic) IBOutlet UILabel *transferFlag;
@property (weak, nonatomic) IBOutlet UIImageView *topgapView;
@property (weak, nonatomic) IBOutlet UIImageView *bottomGapView;
@property (weak, nonatomic) IBOutlet UIImageView *returnStatus;

@property (weak, nonatomic) IBOutlet UILabel *incomeTitleLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleLeadingConstraint;
@end

@implementation MNDPlusRecordListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.topgapView.image = [[UIImage imageNamed:@"investment_record_gap"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 1, 0, 1)];
    self.bottomGapView.image = [[UIImage imageNamed:@"investment_record_gap"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 1, 0, 1)];
    // Initialization code
}

- (void)setRecordModel:(MNDPlusRecordModel *)recordModel {
    _recordModel = recordModel;
    self.investmentTitleLabel.text = recordModel.plan_title;
    self.tenderMoneyLabel.text = recordModel.sign_amount;
    self.yearAprLabel.text = [NSString stringWithFormat:@"%@%%",recordModel.sign_year_apr];

    self.tenderDeadline.text = [NSString stringWithFormat:@"%zd个月",recordModel.plan_deadline];
    self.expectIncomeLabel.text = recordModel.amount;
    if (recordModel.sign_coupon_apr.floatValue > 0) {
        self.rewardAprLabel.hidden = NO;
        self.isReward.hidden = NO;
        self.rewardAprLabel.text = [NSString stringWithFormat:@"+%@%%",recordModel.sign_coupon_apr];
    }else {
        self.rewardAprLabel.hidden = YES;
        self.isReward.hidden = YES;
    }
    
    if (_isExit) {
        self.tenderTimeLabel.text = [NSString stringWithFormat:@"到款日期：%@",recordModel.sign_start_date];
        self.incomeTitleLabel.text = @"已赚收益";
    }else {
        self.tenderTimeLabel.text = [NSString stringWithFormat:@"授权日期：%@",recordModel.sign_start_date];
        self.incomeTitleLabel.text = @"预期收益";
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
